package main

import (
	"ini"
	"log"
)

func main() {
	listener := ini.ListenFunc(func(inifile string) {
		lastModTime := ini.GetModificationTime(inifile)
		log.Println("Start listening...")
		for {
			modtime := ini.GetModificationTime(inifile)
			if modtime > lastModTime {
				log.Println("The inifile has been modified")
				break
			}
		}
	})

	_, err := ini.Watch("my.ini", listener)
	if err != nil {
		panic(err)
	}
}
